package com.augurit.gzcgwsp.lhsp.convert;

import java.util.ArrayList;
import java.util.List;
import org.dozer.DozerBeanMapper; 

import com.augurit.gzcgwsp.lhsp.entity.LhspSendItemNotice;
import com.augurit.gzcgwsp.lhsp.web.form.LhspSendItemNoticeForm;

public class ProcessInstanceConvert {
	public static LhspSendItemNoticeForm convertVoToForm(LhspSendItemNotice entity) {
		if(entity != null) {
			LhspSendItemNoticeForm form = new DozerBeanMapper().map(entity, LhspSendItemNoticeForm.class);
			return form;
		}else
			return null;
	}
	
	public static List<LhspSendItemNoticeForm> convertVoListToFormList(List<LhspSendItemNotice> ywWebserviceInfoList) {
		if(ywWebserviceInfoList != null && ywWebserviceInfoList.size() > 0) {
			List<LhspSendItemNoticeForm> ywYnJzfqwczzXnFormList = new ArrayList();
			for(int i=0; i<ywWebserviceInfoList.size(); i++) {
				ywYnJzfqwczzXnFormList.add(convertVoToForm(ywWebserviceInfoList.get(i)));
			}
			return ywYnJzfqwczzXnFormList;
		}
		return null;
	}
	
	
	public static void convertFormToVo(LhspSendItemNoticeForm form, LhspSendItemNotice entity) {
        if (form == null) return;
        if (entity == null) entity = new LhspSendItemNotice();        
        new DozerBeanMapper().map(form, entity);
    }
	
	public static List<LhspSendItemNotice> convertFormListToVoList(List<LhspSendItemNoticeForm> SendItemNoticeFormList) {
		if(SendItemNoticeFormList != null && SendItemNoticeFormList.size() > 0) {
			List<LhspSendItemNotice> ywWebserviceInfoList = new ArrayList();
			for(int i=0; i<SendItemNoticeFormList.size(); i++) {
				LhspSendItemNotice SendItemNotice = new LhspSendItemNotice();
				convertFormToVo(SendItemNoticeFormList.get(i), SendItemNotice);
				ywWebserviceInfoList.add(SendItemNotice);
			}
			return ywWebserviceInfoList;
		}
		return null;
	}
	
}
